home *** CD-ROM | disk | FTP | other *** search
/ Aminet 32 / Aminet 32 (1999)(Schatztruhe)[!][Aug 1999].iso / Aminet / dev / lang / Python152_Src.lha / Python152_Source / Amiga / isatty.c < prev    next >
C/C++ Source or Header  |  1994-09-30  |  707b  |  35 lines

  1. RCS_ID_C="$Id: isatty.c,v 4.1 1994/09/29 23:09:02 jraja Exp $";
  2. /*
  3.  *      isatty.c - check is a file is a terminal (interactive) or not (SAS/C)
  4.  *
  5.  *      Copyright © 1994 AmiTCP/IP Group, 
  6.  *                       Network Solutions Development Inc.
  7.  *                       All rights reserved.
  8.  */
  9.  
  10. #include <ios1.h>
  11. #include <fcntl.h>
  12. #include <stdlib.h>
  13. #include <dos.h>
  14. #include <dos/dos.h>
  15. #include <proto/dos.h>
  16.  
  17. int
  18. isatty(int fd)
  19. {
  20.   struct UFB *ufb;
  21.  
  22.   /*
  23.    * find the ufb *
  24.    */
  25.   if ((ufb = __chkufb(fd)) != NULL &&
  26.       !(ufb->ufbflg & UFB_SOCK)) { /* A socket is not a tty */
  27.     /*
  28.      * Convert DOSBOOL to BOOL
  29.      */
  30.     return (IsInteractive(ufb->ufbfh) & 0x1);
  31.   }
  32.   
  33.   return 0;
  34. }
  35.